﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LoaiPhuKien_Entry.ascx.cs" Inherits="cbmobile.UserControl.LoaiLinhKien_Entry" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>
<script type="text/javascript">

    var activeArea = null;
    var winW = 0;
    var winH = 0;
    var clickX = 0;
    var clickY = 0;
    function GetWindowSize() {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            winH = document.body.clientHeight;
            winW = document.body.clientWidth;
        } else {
            winH = window.innerHeight;
            winW = window.innerWidth;
        }
    }
    function GetMouseXY(e) {
        if (navigator.appName.indexOf("Microsoft") != -1) { // grab the x-y pos.s if browser is IE
            clickX = e.clientX + document.body.scrollLeft
            clickY = e.clientY + document.body.scrollTop
        } else {  // grab the x-y pos.s if browser is NS
            clickX = e.pageX
            clickY = e.pageY
        }
        // catch possible negative values in NS4
        if (clickX < 0) clickX = 0;
        if (clickY < 0) clickY = 0;
        return true
    }

    function AreaContains(parent, child) {
        while (child)
            if (parent == child) return true;
            else
                child = child.parentNode;

        return false;
    }
    function PopupAreaMouseOut(e) {
        if (!e)
            var e = window.event;
        var targ = e.relatedTarget ? e.relatedTarget : e.toElement;
        if (activeArea != null && !AreaContains(activeArea, targ)) {
            activeArea.style.display = 'none';
            activeArea = null;
        }
    }

    function PopupArea(e) {
        // get viewing size 
        GetWindowSize();
        GetMouseXY(e);

        // hide the old area
        if (activeArea != null) {
            activeArea.style.display = 'none';
        }

        // pop-up area
        var popupArea = document.getElementById("divImageProduct");
        popupArea.style.position = 'absolute';
        popupArea.style.display = 'inline';
        popupArea.style.zIndex = "9999";
        popupArea.style.top = clickY - 78 + 'px';
        popupArea.style.left = clickX + 10 + 'px';

        popupArea.onmouseout = PopupAreaMouseOut;
        document.body.appendChild(popupArea);

        // keep the pop-up area
        activeArea = popupArea;
    }

    function ShowImage(event, isShow) {

        if (isShow == 0) {
            document.getElementById("divImageProduct").style.display = 'none';
            return false;
        } else {
            PopupArea(event);
            return false;
        }

    }

</script>
<script type="text/javascript">
    function validateChooseDropList(oSrc, args) {
        args.IsValid = (args.Value != '0');
    }
</script>
<div class="sb-box">
    <div class="header">
        <h3>
            Thông tin Loại phụ kiện</h3>
    </div>
    <div class=" clear">
    </div>
    <div class="bcont">
        <div class="selection">

            <asp:FormView ID="frmBlogCate" CellPadding="0" runat="server" DataSourceID="ObjectDataSource1"
                onupdating="frmBlogCate_ItemUpdating" OnItemInserted="frmBlogCate_ItemInserted"
                OnItemInserting="frmBlogCate_ItemInserting" OnItemDeleted="frmBlogCate_ItemDeleted"
                OnDataBound="frmBlogCate_DataBound">
                <ItemTemplate>
                    <table border="0">
                        <tr>
                            <td class="setup01">
                                Mã loại phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblName" runat="server" Text='<%# Bind("Ma_LoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Parent ID
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Parent_ID") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Tên loại phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("TenLoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Thứ tự
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblSort_Order" runat="server" Text='<%# Bind("ThuTu") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                                <asp:Label ID="lblStatus" runat="server" Text='<%# StatusName(Eval("TrangThai")) %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                    Text="Edit" CssClass="button"><span>Edit</span></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="DeleteButton" OnClientClick='return confirm("Do you want delete this item?");'
                                    runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" CssClass="button"><span>Delete</span></asp:LinkButton>
                                &nbsp; <a href='<%=this.ListLink %>' class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <EditItemTemplate>
                    <table border="0">
                        <tr>
                            <td class="setup01">
                                Tên loại phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtName" CssClass="inputtext medium" runat="server" Text='<%# Bind("TenLoaiPhuKien") %>' />
                                <asp:RequiredFieldValidator ID="rfilName" runat="server" ErrorMessage=" Tên không được để trống !" ForeColor="red" ControlToValidate="txtName" ValidationGroup="CheckCategory"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Parent ID
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtDescription" TextMode="MultiLine" Width="308px" runat="server" Text='<%# Bind("Parent_ID") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Thứ tự
                            </td>
                            <td class="setup02">
                                <asp:TextBox ID="txtSort_Order" CssClass="inputtext medium" runat="server" Text='<%# Bind("ThuTu") %>' />
                                <asp:RequiredFieldValidator ID="rfilSort_Order" runat="server" ErrorMessage=" không được để trống !" ForeColor="red" ControlToValidate="txtSort_Order" ValidationGroup="CheckCategory"></asp:RequiredFieldValidator>
                                <%--<asp:FilteredTextBoxExtender ID="ftbeSO" FilterType="Numbers" TargetControlID="txtSort_Order"
                                    runat="server">
                                </asp:FilteredTextBoxExtender>--%>
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                               <asp:DropDownList ID="ddlStatus" runat="server" >
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="EditButton" ValidationGroup="CheckCategory" runat="server" CausesValidation="True"
                                    CommandName="Update" Text="Edit" CssClass="button"><span>Update</span></asp:LinkButton>
                                &nbsp;&nbsp;&nbsp;<a href='<%=this.ListLink %>' class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <table border="0">
                        <table border="0">
                        <tr>
                            <td class="setup01">
                                Parent ID
                            </td>
                            <td class="setup02">
                                <asp:Textbox ID="lblDescription" runat="server" Text='<%# Bind("Parent_ID") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Tên loại phụ kiện
                            </td>
                            <td class="setup02">
                                <asp:Textbox ID="txtTen" runat="server" Text='<%# Bind("TenLoaiPhuKien") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Thứ tự
                            </td>
                            <td class="setup02">
                                <asp:Textbox ID="lblSort_Order" runat="server" Text='<%# Bind("ThuTu") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="setup01">
                                Trạng thái
                            </td>
                            <td class="setup02">
                                <asp:DropDownList ID="ddlStatus" runat="server" >
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="C pdT10" colspan="2">
                                <asp:LinkButton ID="EditButton" runat="server" ValidationGroup="CheckCategory" CausesValidation="True"
                                    CommandName="Insert" Text="Edit" CssClass="button"><span>Insert</span></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                    Text="Cancel" CssClass="button"><span>Delete</span></asp:LinkButton>
                                &nbsp; <a href="<%=this.ListLink %>" class="button"><span>Cancel</span></a>
                            </td>
                        </tr>
                    </table>
                </InsertItemTemplate>
            </asp:FormView>

        </div>
    </div>
</div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    DeleteMethod="Delete" 
    SelectMethod="Get_LoaiPhuKien_By_ID" TypeName="cbmobile.BLC.BLC_LoaiPhuKien" 
    UpdateMethod="Update" oninserting="ObjectDataSource1_Inserting" 
    onupdating="ObjectDataSource1_Updating">
    <DeleteParameters>
        <asp:QueryStringParameter DefaultValue="-1" Name="Ma_LoaiPhuKien" 
            QueryStringField="Ma_LoaiPhuKien" Type="Int32" />
    </DeleteParameters>
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="-1" Name="Ma_LoaiPhuKien" 
            QueryStringField="Ma_LoaiPhuKien" Type="Int32" />
    </SelectParameters>
    <UpdateParameters>
        <asp:QueryStringParameter DefaultValue="-1" Name="Ma_LoaiPhuKien" 
            QueryStringField="Ma_LoaiPhuKien" Type="Int32" />
        <asp:Parameter Name="Parent_ID" Type="Int32" />
        <asp:Parameter Name="TenLoaiPhuKien" Type="String" />
        <asp:Parameter Name="ThuTu" Type="Int32" />
        <asp:Parameter Name="TrangThai" Type="Int32" />
    </UpdateParameters>
</asp:ObjectDataSource>
